#字面量
#变量
import requests



#rep = requests.post(url, data=None, json=None)#**kwargs)
# requests.get(url, params=None, **kwargs)
# requests.put(url, data=None, **kwargs)
# requests.delete(url, **kwargs)
# print(rep.json())
# print(rep.text)
# print(rep.json())
# print(rep.content)
# print(rep.headers)
# print(rep.status_code)


# num1 = 'zimianliang'
# print(num1)

# class TestLogin:
#     def login(self):
#         pass
#     def outlogin(self):
#         pass

class TestApi:

#登录
    def test_get_token(self):
        url = "http://8.147.105.44:3001/prod-api/login"
        datas = {
           "password":"123456",
           "username":"fujipeng"
        }
        req=requests.post(url,params=datas)
        print(req.json())

if __name__ =='__main__':
        TestApi().test_get_token()

# PASSED[100%]{'msg': 'Required request body is missing: public com.huayue.common.core.domain.AjaxResult
# com.huayue.web.controller.system.SysLoginController.login(com.huayue.common.core.domain.model.LoginBody)', 'code': 500}


# import requests
# import pytest
#
#
# class TestApi:
#     # 登录
#     def test_get_token(self):
#         url = "http://8.147.105.44:3001/prod-api/login"
#         datas = {
#             "password": "123456",
#             "username": "fujipeng"
#         }
#         # 使用json参数传递请求体
#         req = requests.post(url, json=datas)
#
#         # 解析JSON响应
#         response = req.json()
#
#         # 断言HTTP状态码为200
#         assert req.status_code == 200, f"HTTP状态码错误: {req.status_code}"
#
#         # 断言业务状态码为成功（根据接口规范调整）
#         assert response.get("code") == 200, f"业务状态码错误: {response.get('code')}"
#
#         # 断言返回消息为成功（根据接口规范调整）
#         assert response.get("msg") == "操作成功", f"返回消息不符: {response.get('msg')}"
#
#         # 断言返回结果中包含token字段（根据接口规范调整）
#         assert "token" in response.get("data", {}), "返回结果中缺少token字段"
#
#         # 打印成功消息和token
#         print(f"登录成功，token: {response['data']['token']}")
#
#
# if __name__ == '__main__':
#     pytest.main([__file__, '-v'])
